package com.gitee.cui.springcloud.controller;

import javax.annotation.Resource;

import com.gitee.cui.springcloud.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022-03-07 12:16
 **/
@RestController
@Slf4j
@RequestMapping(value = "/payment")
public class PaymentController {

	@Resource
	private PaymentService paymentService;

	@GetMapping(value = "/hystrix/ok/{id}")
	public String paymentInfoOk(@PathVariable("id") Long id) {
		return paymentService.paymentInfoOk(id);
	}

	@GetMapping(value = "/hystrix/timeout/{id}")
	public String paymentInfoTimeout(@PathVariable("id") Long id) {
		return paymentService.paymentInfoTimeout(id);
	}

	// ===========服务熔断

	@GetMapping(value = "/circuit/{id}")
	public String paymentCircuitBreaker(@PathVariable("id") Long id) {
		return paymentService.paymentCircuitBreaker(id);
	}
}
